# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgbase=jsonrpc-glib
pkgname=(jsonrpc-glib jsonrpc-glib-docs)
pkgver=3.44.0
pkgrel=1
pkgdesc="A JSON-RPC library for GLib"
url="https://gitlab.gnome.org/GNOME/jsonrpc-glib"
arch=(loong64 x86_64)
license=(LGPL)
depends=(json-glib)
makedepends=(
  gi-docgen
  git
  gobject-introspection
  meson
  vala
)
_commit=89f25f9789b8323c6c06ac086d1fba2836113f16  # tags/3.44.0^0
source=("git+https://gitlab.gnome.org/GNOME/jsonrpc-glib.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname
}

build() {
  arch-meson $pkgname build -D enable_gtk_doc=true
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_jsonrpc-glib() {
  provides=(libjsonrpc-glib-1.0.so)

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc
}

package_jsonrpc-glib-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
